import router  from "@/router/index.js";
import {useCounterStore} from "@/store/count.js";


// 3. 全局路由守卫（可选）
router.beforeEach((to, from, next) => {
    // 示例：登录验证
    const isAuthenticated = localStorage.getItem('token');
    if (to.meta.requiresAuth && !isAuthenticated) {
        next({ name: 'Login' });
    } else {
        next();
        const countStore = useCounterStore();
        countStore.count++
        console.log('全局路由守卫 触发')
    }
});